public class login {
    public String username="bit";
    public int password=123;
    public void check (String username,int password)throws userNameException,passWordException{
        if(!this.username.equals(username)){
            throw new userNameException("yonghumingcuowu"+username);
        }
        if(!(this.password==password)){
            throw new passWordException("mimacuowu"+password);
        }
        System.out.println("true");
    }
    public static void main (String[] args) {
        login user=new login();
        try{
            user.check("bit2",123);
        }catch(userNameException e){
            e.printStackTrace();
            System.out.println("用户名不正确");
        }catch (passWordException e){
            e.printStackTrace();
            System.out.println("密码不正确");
        }

    }
}
